package routers

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func LoadUser(engine *gin.Engine) {
	engine.GET("/user/:name", func(ctx *gin.Context) {
		name := ctx.Param("name")
		ctx.String(http.StatusOK, "name "+name)
	})

	engine.GET("/user", func(ctx *gin.Context) {
		name := ctx.DefaultQuery("name", "编程宝库")
		ctx.String(http.StatusOK, fmt.Sprintf("name=%s", name))
	})
}
